Skip to content

feat(graph): re-land Hamming-plane DistanceMeans on main (stranded by #545 stacked-merge order)#548

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/value-tier-replant
Jun 19, 2026
Merged

feat(graph): re-land Hamming-plane DistanceMeans on main (stranded by #545 stacked-merge order)#548
AdaWorldAPI merged 1 commit into
mainfrom
claude/value-tier-replant

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Re-land the Hamming-plane DistanceMeans on main

Why this exists: #545 was stacked on the inc0 branch (base = claude/inc0-mailbox-soa-backend). When both merged, the order was inc0→main (#544, 08:07:43) then #545→inc0 (08:08:00) — so #545's content landed in the inc0 branch after inc0 had already merged to main, and never reached main. Verified: DistanceMeans::Hamming / identity_plane_at are absent from current main.

This PR re-lands exactly the 3 code files on top of current mainno board/doc churn, no deletion of other merged work (the stale value-tier branch couldn't be PR'd directly because main has since advanced).

Content (identical to the merged-but-stranded #545)

  • contract soa_view: IdentityPlane enum + MailboxSoaView::identity_plane_at (deferred-binding default None).
  • core mailbox_scan: DistanceMeans::Hamming(IdentityPlane) + the node_distance arm — popcount(XOR) over the value plane. Costed tier; returns None on the zero-decode fake so feat(graph): Backend::MailboxSoa — classid node-match + CLAM/CAKES neighborhood (Inc 0) #544's F2 gate is untouched.
  • cognitive-shader-driver: the identity_plane_at override on the real MailboxSoA<N> (the codex P2 fix) — Content/Topic/Anglecontent_row/topic_row/angle_row, guarded by populated (no padding rows).

Tests

contract soa_view 4/4 · cognitive-shader-driver identity_plane_at 1/1 · lance-graph mailbox_scan 13/13 · fmt + clippy clean.

🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added Hamming distance computation mode for graph mailbox operations.
  • Bug Fixes

    • Improved data integrity by ensuring only populated rows are exposed; padding rows are properly excluded from lookups.

…545 stacked-merge order)

#545 merged into the inc0 branch ~17s AFTER inc0->main (#544) had already
merged, so its content (the value-tier Hamming means) never reached main. This
re-lands exactly the 3 code files on top of current main — no board/doc churn,
no deletion of other merged work:

- contract soa_view: IdentityPlane enum + MailboxSoaView::identity_plane_at
  (deferred-binding default None).
- core mailbox_scan: DistanceMeans::Hamming(IdentityPlane) + node_distance arm
  (popcount XOR over the value plane; costed tier, returns None on the
  zero-decode fake so the F2 gate is untouched).
- cognitive-shader-driver: identity_plane_at override on the real MailboxSoA<N>
  (Content/Topic/Angle -> content_row/topic_row/angle_row, guarded by populated)
  — the codex P2 fix so Hamming works on the live view.

Tests: contract soa_view 4/4, cognitive-shader-driver identity_plane_at 1/1,
lance-graph mailbox_scan 13/13. fmt + clippy clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CcpLeEC3XK8Eye53GKBVvi
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 24d73c69-e68a-46df-8d56-13b956da646f

📥 Commits

Reviewing files that changed from the base of the PR and between 5ad6871 and b8ea988.

📒 Files selected for processing (3)
  • crates/cognitive-shader-driver/src/mailbox_soa.rs
  • crates/lance-graph-contract/src/soa_view.rs
  • crates/lance-graph/src/graph/mailbox_scan.rs

📝 Walkthrough

Walkthrough

Adds a public IdentityPlane enum (Content, Topic, Angle) and a default identity_plane_at accessor to the MailboxSoaView trait. DistanceMeans gains a Hamming(IdentityPlane) variant computed via XOR-popcount over fetched identity-plane slices. MailboxSoA overrides identity_plane_at with a populated-row gate that returns None for padding rows.

Changes

IdentityPlane contract, Hamming distance, and MailboxSoA wiring

Layer / File(s) Summary
IdentityPlane enum and trait method
crates/lance-graph-contract/src/soa_view.rs
Adds IdentityPlane { Content, Topic, Angle } and MailboxSoaView::identity_plane_at(row, plane) -> Option<&[u64]> with a None default, establishing the contract for value-side fingerprint plane reads.
Hamming distance variant and node_distance computation
crates/lance-graph/src/graph/mailbox_scan.rs
Adds DistanceMeans::Hamming(IdentityPlane), extends node_distance to XOR fetched plane slices and sum popcounts, updates GuardedSoa test fixture with content_planes and identity_plane_at, and adds a unit test verifying correct XOR-popcount, zero self-distance, and None fallbacks.
MailboxSoA override with padding-row gating
crates/cognitive-shader-driver/src/mailbox_soa.rs
Implements identity_plane_at on MailboxSoA to return None for rows ≥ populated and dispatch Content/Topic/Angle to the corresponding slice accessors; adds IdentityPlane import and a unit test covering all three planes for both populated and padding rows.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • AdaWorldAPI/lance-graph#437: Introduced the MailboxSoaView trait in lance-graph-contract/src/soa_view.rs that this PR directly extends with IdentityPlane and identity_plane_at.
  • AdaWorldAPI/lance-graph#519: Modified mailbox_soa.rs to use the populated row count to prevent exposing padding rows, the same gating pattern this PR applies inside identity_plane_at.
  • AdaWorldAPI/lance-graph#544: Extended the mailbox_scan.rs distance-scoring machinery and MailboxSoaView accessor patterns that this PR builds on to add the Hamming distance mode.

Poem

🐇 Hop, hop, through planes of bits I go,
Content and Topic and Angle in a row,
XOR the fingerprints, count every one,
Padding rows stay None — their data is done.
The Hamming bunny has measured the space,
Identity planes all snug in their place! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: re-landing stranded Hamming-plane DistanceMeans functionality. It accurately describes the core purpose of the PR and provides relevant context about the merge timing issue that prompted this work.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AdaWorldAPI AdaWorldAPI merged commit d9ac5af into main Jun 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants